#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 2e5 + 10;

int K, a[N], n, cnt;
ll s[N], b[N];

struct BIT {
	int tr[N];
	void add(int x, int v) { for(; x <= cnt; x += x & -x) tr[x] += v; }
	int query(int x) { int res = 0; for(; x; x -= x & -x) res += tr[x]; return res; }
} T;
	
int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
    n = in; K = in; rep(i, 1, n) a[i] = in, s[i] = s[i - 1] + a[i] - K, b[i] = s[i];
	b[n + 2] = 0; sort(b + 1, b + n + 2); cnt = unique(b + 1, b + n + 2) - b - 1;
	ll ans = 0; T.add(lower_bound(b + 1, b + cnt + 1, 0) - b, 1);
	rep(i, 1, n) {
		int t = lower_bound(b + 1, b + cnt + 1, s[i]) - b; 
		ans += T.query(t); T.add(t, 1); 
	} printf("%lld\n", ans); return 0;
}
